# 继承：代码好管理，方便拓展
# 主类：Pet
class Pet:
    name = ""
    age = 0
    pet_t = ""

    # 构造函数
    def __init__(self, name, age, pet_t):
        self.name = name
        self.age = age
        self.pet_t = pet_t

    # 动物的默认叫声
    def display(self):
        print(f"名字：{self.name}，年龄：{self.age}，是一只{self.pet_t}，叫了一声！")


# dog类，属于Pet的子类，继承于Pet
class Dog(Pet):
    color = ""

    # Dog的构造函数并且继承于Pet的构造函数
    def __init__(self, name, age, pet_t, color):
        Pet.__init__(self, name, age, pet_t)
        self.color = color

    def DogColor(self):
        print(f"这是一只颜色为{self.color}的狗!")

    def display(self):
        print(f"名字：{self.name}，年龄：{self.age}，是一只{self.pet_t}，汪了一声！")


if __name__ == '__main__':
    bird = Pet("小鸟", 1, "鸟")
    huang = Dog("大黄", 2, "狗", "黄色")

    bird.display()
    huang.display()
    huang.DogColor()